package serach;

import com.sun.org.apache.regexp.internal.RE;

public class BM21 {
    public int minNumberInRotateArray(int[] array) {
        int start = 0;
        int end = array.length - 1;
        int min = Integer.MAX_VALUE;
        while (start < end) {
            int mid = (start + end) / 2;
            if (array[mid] > array[end]) {
                start = mid + 1;
            }
            if (array[mid] == array[end]) {
                end = end - 1;
            } else if(array[mid]<array[end]) {
                end = mid;
            }

        }
        return array[end];
    }
}
